<?php
/**
 * Created by PhpStorm.
 * User: luiz
 * Date: 2019/6/11
 * Time: 19:38
 */

namespace app\api\controller\v1;


use app\api\controller\BaseConitroller;
use app\api\service\WxNotify;
use app\api\validate\IDMustBePostiveInt;
use app\lib\exception\IdException;
use app\api\service\Pay as PayS;
class pay extends BaseConitroller
{

    protected $beforeActionList = [
        'checkExclusiveScope'=>['only'=>'placeOrder']
    ];

    public function getPreOrder($id='')
    {
        (new IDMustBePostiveInt())->goCheck();
        $pay = new PayS($id);
        return $pay->pay();
    }

    public function receiveNotify()
    {
        //通知频率15/15/30 单位s
        //检测库存量,超卖
        //更新这个订单的状态，order status字段
        //减库存
        //如果成功处理，返回成功处理消息，否则返回没有成功信息
        //特点：post ，xml 格式，不会携带参数
        $notify = new WxNotify();
        $notify->Handle();
    }
}